//
//  BaseRequest.h
//  CharonTVProject
//
//  Created by karong on 2023/6/7.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

typedef void (^Failure)(NSURLResponse *response, NSError *error, id responseObject);

@interface BaseRequest : NSObject

/*
 *  POST請求，默認附帶项目所需的header信息
 */
+ (void)postWithURLString:(NSString *)URLString
               parameters:(id)parameters
                  success:(void (^)(NSDictionary *responseDict))success
                  failure:(Failure)failure;

/*
 *  POST請求，默認附帶项目所需的header信息
 *  不加密
 */
+ (void)postAppleOrderWithURLString:(NSString *)URLString
                         parameters:(id)parameters
                            success:(void (^)(NSDictionary *dataDict))success
                            failure:(Failure)failure;

/*
 *  GET請求，默認附帶项目所需的header信息
 */
+ (void)getWithURLString:(NSString *)URLString
              parameters:(id)parameters
                 success:(void (^)(NSDictionary *dataDict))success
                 failure:(Failure)failure;

/*
 *  上傳圖片
 */
+ (void)postWithURLString:(NSString *)URLString
               parameters:(id)parameters
                fileDatas:(NSArray<NSData *> *)fileDatas
                fileNames:(NSArray<NSString *> *)fileNames
                  success:(charonTV_DictionaryBlock)success
                  failure:(Failure)failure;

@end

NS_ASSUME_NONNULL_END
